From 0775a89d733f6976625ff8b41217440c1301449a Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 21 Jul 2008 21:51:51 +0000 Subject: [PATCH] Allow $wgCookiePrefix to be set by the user. Default is false which keeps current behavior in Setup. Fixes bug 14843. --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 6 ++++++ includes/Setup.php | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 54ffea4a69..05a404cc16 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -68,6 +68,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN with MimeMagic. * Added $wgDirectoryMode, which allows for setting the default CHMOD value when creating new directories. +* (bug 14843) $wgCookiePrefix can be set by LocalSettings now, false defaults + current behavior. === New features in 1.13 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2e2a9a1e65..3a13d3221d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1527,6 +1527,12 @@ $wgCookiePath = '/'; $wgCookieSecure = ($wgProto == 'https'); $wgDisableCookieCheck = false; +/** + * Set $wgCookiePrefix to use a custom one. Setting to false sets the default of + * using the database name. + */ +$wgCookiePrefix = false; + /** * Set authentication cookies to HttpOnly to prevent access by JavaScript, * in browsers that support this feature. This can mitigates some classes of diff --git a/includes/Setup.php b/includes/Setup.php index 61b31739ad..cf8aa9b922 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -204,14 +204,16 @@ wfProfileIn( $fname.'-SetupSession' ); # Set default shared prefix if( $wgSharedPrefix === false ) $wgSharedPrefix = $wgDBprefix; -if ( in_array('user', $wgSharedTables) && $wgSharedDB && $wgSharedPrefix ) { - $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix; -} elseif ( in_array('user', $wgSharedTables) && $wgSharedDB ) { - $wgCookiePrefix = $wgSharedDB; -} elseif ( $wgDBprefix ) { - $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix; -} else { - $wgCookiePrefix = $wgDBname; +if( !$wgCookiePrefix ) { + if ( in_array('user', $wgSharedTables) && $wgSharedDB && $wgSharedPrefix ) { + $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix; + } elseif ( in_array('user', $wgSharedTables) && $wgSharedDB ) { + $wgCookiePrefix = $wgSharedDB; + } elseif ( $wgDBprefix ) { + $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix; + } else { + $wgCookiePrefix = $wgDBname; + } } $wgCookiePrefix = strtr($wgCookiePrefix, "=,; +.\"'\\[", "__________"); -- 2.20.1